<template>
    <div>
        <a-dropdown>
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <template #dropdown>
          <a-menu>
        <a-menu-item>
          <a @click="logout">退出登录</a>
        </a-menu-item>
          </a-menu>
        </template>
      </a-dropdown>
      <span>王小虎</span>
    </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    async logout() {
      await this.$store.dispatch("user/logout");
      this.$router.push(`/login?redirect=${this.$route.fullPath}`);
    }
  }
};
</script>
<style>
</style>